package UDP协议;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;


import java.net.DatagramSocket;
import java.net.InetAddress;

public class 发送数据 {
    public static void main(String[] args) throws IOException {


        DatagramSocket ds = new DatagramSocket();

        String str = "你好啊";
        byte[] bytes = str.getBytes();
        InetAddress address = InetAddress.getByName("127.0.0.1");
        int port = 10086;

        DatagramPacket dp = new DatagramPacket(bytes,bytes.length,address,port);
        ds.send(dp);

        ds.close();




    }
}
